<template>
	<view>
		<image mode="scaleToFill" class="successImg" src="/static/images/success-bg.png" />
		<view class="success-top">
			<van-loading type="spinner" color="#fff" size="60px" />
			<view class="top-font">
				<view>
					{{is_flag==1?'正在审核中':'审核通过'}}
				</view>
				<view style="font-size:28rpx;margin-top:15rpx ">
					{{is_flag==1?'预计1分钟内出结果，请耐心等待！':'正在跳转页面中...'}}
				</view>
			</view>
		</view>
		<view class="bottom-btn flex justify-between">
			<view class="btn" @click="checkOrder()">查看订单</view>
			<view class="btn indexBtn" @click="returnHome()">返回首页</view>
		</view>
	</view>
</template>

<script>
	import {
		fraudStatus
	} from '@/api/order'
	let timerId = ""
	export default {
		data() {
			return {
				is_flag: 1,
				orderId: ''
			}
		},
		onLoad(options) {
			const {
				orderId
			} = options;
			timerId = setInterval(() => {
				if (this.is_flag == '2') {
					clearInterval(timerId);
					uni.reLaunch({
						url: "/pagesA/my/order/myorder/orderDetail?order_id=" + orderId
					})
				} else {
					fraudStatus(orderId).then(res => {
						this.is_flag = res
					})
				}
			}, 5000)
		},
		onUnload() {
			clearInterval(timerId);
		},
		methods: {
			checkOrder() {
				const {
					orderId
				} = this;
				uni.reLaunch({
					url: "/pagesA/my/order/myorder/orderDetail?order_id=" + orderId
				})
			},
			returnHome() {
				const {
					orderId
				} = this;
				uni.switchTab({
					url: '/pages/index/index'
				});
			}
		}
	}
</script>

<style lang="scss" scoped>
	.success {
		font-family: Source Han Sans CN;
		color: #333333;
		font-size: 26rpx;
	}

	.successImg {
		position: relative;
		width: 100%;
		height: 400rpx;
	}

	.success-top {
		width: 100%;
		box-sizing: border-box;
		text-align: center;
		position: absolute;
		top: 60px;
	}

	.success-top image {
		width: 102rpx;
		height: 102rpx;
		margin-bottom: 30rpx;
	}

	.top-font {
		font-size: 45rpx;
		color: #FFFFFF;
	}

	.pay-info {
		margin-top: 50rpx;
		padding: 0 40rpx;
	}

	.pay-info view {
		line-height: 60rpx;
	}

	.line {
		padding-bottom: 15rpx;
		border-bottom: 1px dashed #CDCDCD;
	}

	.pay-info text {
		float: right
	}

	.bottom-btn {
		padding: 30rpx 70rpx;
	}

	.btn {
		width: 35%;
		height: 80rpx;
		line-height: 80rpx;
		background: #FFFFFF;
		border: 2rpx solid #F72020;
		border-radius: 40rpx;
		text-align: center;
		padding: 0 30rpx;
		margin-top: 50rpx;
		color: #F72020;
		font-size: 34rpx;
	}

	.indexBtn {
		color: #fff;
		background: linear-gradient(90deg, #FF5346, #FA122A);
	}

	.danbaoImg {
		width: 100%;
		height: 700rpx;
	}

	.proof_info {
		text-align: center;
		color: #FF2727;
		font-size: 24rpx;
		font-family: SourceHanSansCN-Regular;
		margin-top: 40rpx;
	}

	.applyBtn {
		text-align: center;
		color: #fff;
		padding: 0 50rpx;
		font-size: 34rpx;
	}

	.proofBtn {
		height: 90rpx;
		line-height: 90rpx;
		margin-top: 26rpx;
		background: #F72020;
		border-radius: 45rpx;
	}
</style>